package nc.ui.test2.inhome.action;

import java.awt.event.ActionEvent;

import nc.ui.pub.pf.PfUtilClient;
import nc.ui.pubapp.uif2app.actions.AbstractReferenceAction;
import nc.ui.pubapp.uif2app.view.BillForm;
import nc.ui.uif2.UIState;
import nc.ui.uif2.model.AbstractAppModel;
import nc.vo.test2.inhome.AggInhomeHVO;

public class AddCH01Action extends AbstractReferenceAction {
	private static final long serialVersionUID = 1L;

	private BillForm editor;
	private AbstractAppModel model;

	@Override
	public void doAction(ActionEvent e) throws Exception {
		
		PfUtilClient.childButtonClicked(getSourceBillType(),getModel() .getContext().getPk_group(),getModel().getContext().getPk_loginUser(),"CH02", getModel().getContext().getEntranceUI(), null, null); 

		  if (PfUtilClient.isCloseOK()) {
			AggInhomeHVO[] vos = (AggInhomeHVO[])PfUtilClient.getRetVos(); 
			  this.getTransferViewProcessor().processBillTransfer(vos);
			  }
	}

	public AbstractAppModel getModel() {
		return this.model;
	}

	public void setModel(AbstractAppModel model) {
		this.model = model;
		this.model.addAppEventListener(this);
	}

	@Override
	protected boolean isActionEnable() {
		return this.model.getUiState() == UIState.NOT_EDIT;
	}

	@Override
	protected boolean isManual() {
		return true;
	}

	public void setEditor(BillForm editor) {
		this.editor = editor;
	}

	public BillForm getEditor() {
		return editor;
	}

}
